package com.hup.minicontroller.server.view;

import android.app.Activity;
import android.view.SurfaceView;
import android.widget.Button;
import android.widget.ListView;
import android.widget.Switch;
import android.widget.TextView;

import com.hup.minicontroller.common.constant.NetConstant;
import com.hup.minicontroller.common.view.SeekBarView;
import com.hup.minicontroller.server.R;

import butterknife.BindView;
import butterknife.ButterKnife;

public class MainForm {
    public static final int RESOURCE_ID = R.layout.activity_main;
    //总开关
    @BindView(R.id.cbEnableLan)
    public Switch cbEnableLan;
    @BindView(R.id.cbEnableBluetooth)
    public Switch cbEnableBluetooth;
    @BindView(R.id.btnExit)
    public Button btnExit;
    @BindView(R.id.txtNetSpeed)
    public TextView txtNetSpeed;
    @BindView(R.id.txtDeviceState)
    public TextView txtDeviceState;
    //配置
    @BindView(R.id.cbShowCursor)
    public Switch cbShowCursor;
    @BindView(R.id.cbEnableControl)
    public Switch cbEnableControl;
    @BindView(R.id.btnGotoAccessibility)
    public TextView btnGotoAccessibility;
    @BindView(R.id.cbEnableScreen)
    public Switch cbEnableScreen;
    @BindView(R.id.sbFps)
    public SeekBarView<Integer> sbFps;
    @BindView(R.id.sbScreenSize)
    public SeekBarView<Integer> sbScreenSize;
    @BindView(R.id.sbScreenQuality)
    public SeekBarView<Integer> sbScreenQuality;
    //客户端
    @BindView(R.id.lvClient)
    public ListView lvClient;
    @BindView(R.id.svScreenCapture)
    public SurfaceView svScreenCapture;

    public MainForm(Activity activity) {
        ButterKnife.bind(this, activity);
        sbFps.setValues(parse(NetConstant.FPS));
        sbScreenSize.setValues(parse(NetConstant.SCREEN_SIZE));
        sbScreenQuality.setValues(parse(NetConstant.SCREEN_QUALITY));
    }

    private String parse(int[] array) {
        StringBuilder sb = new StringBuilder();
        for (int val : array) {
            sb.append(val).append(',');
        }
        sb.deleteCharAt(sb.length() - 1);
        return sb.toString();
    }
}
